import { Component, OnInit } from '@angular/core';
import { CommonService } from '../../service/common.service'

@Component({
  selector: 'app-xchtbrecord',
  templateUrl: './xchtbrecord.page.html',
  styleUrls: ['./xchtbrecord.page.scss'],
})
export class XchtbrecordPage implements OnInit {

  constructor(private common:CommonService) { }

  public list:any[] = [];
  public page:number = 1
  public limit:number = 10
  public flag:boolean = false

  ngOnInit() {
    this.PayDetail()
  }

  // 获取充值明细
  PayDetail(){
    var api = '/tbr/getTestWithdrawadLogDetail'
    var params = {
      userId:this.common.getInfo().userId,
      page:this.page,
      limit:this.limit
    }
    console.log(this.page)
    this.common.post(api,params,false).then((res:any)=>{
      if(res.code == 200){
        for(var i=0;i<res.data.records.length;i++){
          this.list.push(res.data.records[i])
        }
        if(res.data.records.length < this.limit){
          this.flag = true
        }
      }
    })
  }

  loadData(event){
      if (this.flag == true) {
        event.target.disabled = true;
        return
      }
    setTimeout(()=>{
      this.page += 1;
      this.PayDetail()
      event.target.complete();
    },700)
  }

}